<template>
  <view class="container">
    <view class="top-section" :style="{ paddingTop: statusBarHeight }">
     	<view class="nav d-flex px-4 a-center font-lg text-light" :style="{ height: navBarHeight }">
     		<view class="iconfont icon-back" @click="backFn"></view>
     		<view class="flex-1">{{ title }}</view>
     	</view>
     	<view class="steps"><step-bar :stepList="numList" :step="current"></step-bar></view>
    </view>
	
	
    <scroll-view class="middle-section pt-3" :scroll-into-view="scrollTop"  scroll-y="true">
      <view v-if="current == 1" class="px-4 text-l">
        <view class="py-3 font-lg text-main text-c">精策云用户注册协议</view>
        <view class="font-sm line-h-md text-tips">
          <view class="plain">欢迎使用“精策云” 平台，本平台作为项目经营信息平台，旨在高效整合企业间经营信息资源，助力企业协同发展、及时把握瞬时商机。为确保平台规范、有序、安全运行，保障全体用户权益，请您在使用前仔细阅读以下须知内容。</view>
          <view class="t1">1.平台概述</view>
          <view class="t2">1.1功能定位</view>
          <view class="plain">“精策云” 具备经营信息的搜集、分析、推送和获取等核心功能。用户端专为经营人员打造，方便大家及时上传手头掌握的建设项目经营信息以获取相应收益，同时也能按需检索、筛选并获取平台汇聚的优质项目经营信息，拓展业务视野与渠道。</view>
          <view class="t2">1.2适用范围</view>
          <view class="plain">本平台适用于任何人员使用。</view>
          <view class="t1">2.用户账号管理</view>
          <view class="t2">2.1账号注册与开通</view>
          <view class="plain">新用户由个人在平台完成注册，注册人需如实填写单位名称、经营人员姓名、联系方式、等信息，经平台审核通过后，平台管理方将为其开通对应账号，初始密码以短信形式发送至预留手机号，用户首次登录需及时修改密码。</view>
          <view class="t2">2.2账号安全责任</view>
          <view class="plain">用户对自身账号及密码负有妥善保管责任，不得转借、出租、共享账号给他人使用。如发现账号异常登录、密码泄露等安全问题，应立即联系平台管理员采取冻结账号、修改密码等应急措施；因用户自身疏忽导致账号安全事故，造成单位或平台损失的，需承担相应赔偿责任。</view>
          <view class="t1">3.信息上传规范</view>
          <view class="t2">3.1信息真实性要求</view>
          <view class="plain">用户上传建设项目经营信息务必确保真实、准确、完整，涵盖项目名称、所在地、业主单位、项目规模、预计投资、进展阶段、合作需求等关键要素，严禁虚报、瞒报、篡改信息，所有上传信息将接受平台审核及其他用户监督，虚假信息一经查实，将对上传用户及所属企业予以警告、扣分、限制功能使用等处罚。</view>
          <view class="t2">3.2信息权属与授权</view>
          <view class="plain">上传信息应为用户所在企业合法拥有经营权益或已获授权经营的项目内容，确保不存在超资质无效项目或非法来源项目。若因信息权属问题引发法律争议，由上传企业及相关责任人自行解决并承担全部后果，平台保留追溯权利。</view>
          <view class="t2">3.3信息保密条款</view>
          <view class="plain">涉及国家秘密、商业机密、敏感项目信息等特殊内容，严禁上传至平台；常规项目信息在上传、存储、传输、共享过程中，平台将严格遵循保密协议与数据安全规范，采取加密等技术手段保护信息安全，用户也需严守保密纪律，不得私自向外披露平台信息。 </view>
          <view class="t1">4.信息获取规则</view>
          <view class="t2">4.1获取权限设置</view>
          <view class="plain">平台依据业务领域、过往经营业绩等维度，综合设定差异化信息获取权限，确保公平享有与自身经营能力适配的信息资源，同时激励提升经营水平、拓展业务版图以解锁更高级别权限；特殊高价值信息可按需申请专项查看权限，经平台审核与信息提供方同意后获取。</view>
          <view class="t2">4.2信息使用限制</view>
          <view class="plain">从平台获取的建设项目经营信息仅用于本企业合法经营业务拓展、项目跟踪对接，不得转售、二次传播给第三方机构或个人谋取私利，违反规定者将被收回信息获取权限、取消平台收益资格，并依规追究责任。</view>
          <view class="t1">5.收益规则</view>
          <view class="t2">5.1上传信息收益</view>
          <view class="plain">用户成功上传有效建设项目经营信息且经平台评估、其他企业成功利用该信息促成业务合作或拓展经营机会后，上传单位将依据项目盈利预期、信息价值贡献度等指标，按平台既定收益分成规则获得相应经济奖励，奖励定期核算发放至企业账户，由企业内部依规分配至上传人员。</view>
          <view class="t2">5.2积分激励机制</view>
          <view class="plain">平台设立积分体系，上传优质信息、积极参与信息交互分享、协助平台优化完善等行为均可获积分奖励，积分可对应平台取得相应经营奖励，以提升企业及用户参与平台运营积极性。</view>
          <view class="t1">6.平台服务与支持</view>
          <view class="t2">6.1日常运维保障</view>
          <view class="plain">平台管理团队负责 7×24 小时监控平台运行状态，及时处理服务器故障、网络卡顿、页面异常等技术问题，定期更新优化平台功能、修复漏洞，确保平台稳定高效运行，遇计划内维护升级将提前公告通知，尽量减少对用户业务影响。</view>
          <view class="t2">6.2咨询与培训服务</view>
          <view class="plain">平台为新用户提供操作手册自助学习资料，并定期组织线上线下培训课程，讲解平台使用技巧、政策解读、业务流程优化要点；设立专门客服热线与在线答疑渠道，随时解答用户在使用过程中遇到的疑问，收集反馈意见建议以持续改进服务质量。</view>
          <view class="t1">7.违规处理</view>
          <view class="t2">7.1违规行为界定</view>
          <view class="plain">除上述提及虚假信息上传、违规获取使用信息、破坏账号安全保密规定外，还包括恶意刷屏、诋毁其他用户、利用平台从事违法违纪活动等不良行为，均属违规范畴，严重破坏平台生态与正常运营秩序。</view>
          <view class="t2">7.2处理措施实施</view>
          <view class="plain">针对违规行为，平台将视情节轻重依次采取警告提醒、扣除积分收益、暂停账号功能、注销账号等处罚措施，违规企业及个人需积极整改，待复查合格后方可依规恢复平台正常使用权益。</view>
          <view class="plain">使用 “精测云” 平台即视为您已充分知晓并同意遵守本用户须知各项条款，平台保留对须知内容修订完善权，修订后将及时公示告知，望广大用户持续关注、共同营造优质经营信息共享生态。</view>
        </view>	
      </view>
   
    <view class="px-3 pt" v-if="current == 2">
      <u-form :model="userFormData" ref="uForm">
        <view class="form px-3">
          <u-form-item class="required" label="姓名" label-position="top" :border-bottom="false">
            <u-input border height="80" v-model="userFormData.realName" placeholder="请输入您的姓名" />
          </u-form-item>
          <u-form-item
            class="required"
            label="手机号码"
            label-position="top"
            :border-bottom="false"
          >
            <u-input border height="80" v-model="userFormData.mobile" placeholder="请输入您的手机号码" />
          </u-form-item>
          <u-form-item class="required" label="密码" label-position="top" :border-bottom="false">
            <u-input border height="80" type="password" v-model="userFormData.pwd" placeholder="请输入您的密码" />
          </u-form-item>
          <u-form-item
            class="required"
            label="确认密码"
            label-position="top"
            :border-bottom="false"
          >
            <u-input border height="80" type="password" v-model="userFormData.confirmPwd" placeholder="请输入确认您的密码" />
          </u-form-item>
          <u-form-item
            class="required"
            label="验证码"
            label-position="top"
            :border-bottom="false"
          >
            <u-input border height="80" v-model="userFormData.smsCode" placeholder="请输入您的验证码" />
          </u-form-item>
          <view class="code">
            <button style="z-index: 1;" class="primaryMiniBnt" @click="showSliderVerifyFn">{{ tips }}</button>									
            <u-toast ref="uToast"></u-toast>
            <u-verification-code
              :seconds="seconds"
              ref="uCode"
              @change="codeChange"
            ></u-verification-code>
          </view>
        </view>
      </u-form>		
    </view>
    
    <view  class="px-3" v-if="current == 3 && isShowName == ''">
      <view
        class="d-flex a-center mt-4  px-2  py-4 corpBox"
        :class="{ active: selected === 'signIn' }"
        @click="selectStyle('signIn')"
      >
        <image
          class="imagesBox"
          mode="aspectFit"
          style=" border-radius: 5px; width: 120rpx; height: 120rpx;"
          :src="getStaticFilePath('ico-zcxqy.png')"
        
        ></image>
      
        <view class="ml-2 font-sm  text-main" :class="{ activeText: selected === 'signIn' }">注册新企业</view>
      </view>
      <view
        class="d-flex a-center mt-4  px-2  py-4 corpBox"
        :class="{ active: selected === 'join' }"
        
        @click="selectStyle('join')"
      >
        <image
        mode="aspectFit"
          class=" imagesBox"
          style=" border-radius: 5px; width: 120rpx; height: 120rpx"
          :src="getStaticFilePath('ico-jrxyqy.png')"
        ></image>
        <view class="ml-2 font-sm  text-main" :class="{ activeText: selected === 'join' }">加入企业</view>
      </view>	
    </view>
    
    <view class="px-3" v-if="current == 3 && isShowName == 'signIn'">
      <view class="pt-3 font-md text-main">企业基本信息</view>
      <u-form :model="companyFormData" ref="companyForm">
        <view class="form">
          <u-form-item
            class="required"
            id='companyNameScroll'
            label="公司名称"
            label-position="top"
            :border-bottom="false"
          >
            <u-input border height="80" v-model="companyFormData.companyName" placeholder="请输入公司名称" />
          </u-form-item>
          <u-form-item
            class="required"
            id='companyCardTypeScroll'
            label="证件类型"
            label-position="top"
            :border-bottom="false"
          >
            <hpy-form-select
              :dataList="certificateTypeList"
              text="name"
              name="dictId"
              v-model="companyFormData.companyCardTypeId"
              @change="queryVompanyCardTypeName"
              title="请选择证件类型"
              hideBorder
            />
          </u-form-item>
          <u-form-item
            class="required "
            id='companyCardNumberScroll'
            label="证件号码"
            label-position="top"
            :border-bottom="false"
          >
            <u-input border height="80" v-model="companyFormData.companyCardNumber" placeholder="请输入证件号码" />
          </u-form-item>
          <u-form-item
            class="required "
            id='companyAddressScroll'
            label="注册地址"
            label-position="top"
            :border-bottom="false"
          >
            <u-input border height="80" v-model="companyFormData.companyAddress" placeholder="请输入注册地址" />
          </u-form-item>
          <u-form-item class="required " id="businessRangeScroll" label="业务范围" label-position="top" :border-bottom="false">
            <u-input border height="80" v-model="companyFormData.businessRange" placeholder="请输入业务范围" />
          </u-form-item>
          <u-form-item
            class="required "
            id='companyCardFileScroll'
            label="上传证件照片"
            label-position="top"
            :border-bottom="false"
          >								
            <image-upload
              :dataType="1"
              name="file"
              :remove="true"
              :headers="header"
              :action="uploadFileUrl"
              v-model="companyCardFile"
              :compress="true"
              :quality="60"
              mediaType="image"
              :add="true"
              @uploadSuccess="uploadCompanyCardFileFn"
            ></image-upload>
          </u-form-item>
          <u-form-item class="required " id="parentCompanyNameScroll" label="上级组织" label-position="top" :border-bottom="false">
              <u-input border height="80" v-model="companyFormData.parentCompanyName" @click="queryOrganizationFn" placeholder="请选择上级组织" />
              <text class="iconfont icon-xiajiantou u-p-r-10 u-font-28 text-tips" style="position:absolute;    right: 20rpx;"></text>
            
          </u-form-item>
        </view>
          <view class="pt-3 font-md text-main">企业服务能力</view>
        <view>
          <u-form-item
            class="required"
            id="companyServiceTypeListScroll"
            label="产业标记"
            label-position="top"
            :border-bottom="false"
          >
          <uni-data-checkbox multiple v-model="companyServiceTypeList" :localdata="industrialMarkList" @change="queryCompanyServiceTypeFn"></uni-data-checkbox>
          </u-form-item>
          <u-form-item
            class="required"
            id="companyServiceAreaListNameScroll"
            label="服务地区"
            label-position="top"
            :border-bottom="false"
          >
            <view class="d-flex flex-wrap">
              
              <view
                class="py px-2 bg-primary rounded-8 mr-2 mb-1 text-primary"
                v-for="(item,index) in companyServiceAreaListName"
                :key="index"
              >
                {{item.provinceName}} {{item.cityName}}
                <text class="pl-1 iconfont icon-shanchu text-error"  @click="delCityFn(index)"></text>
              </view>
              <view
                class="py px-2 bg-primary rounded-8 mr-2 mb-1 text-primary"
                @click="addCityFn()"
              >
                <text class=" pr-2 iconfont icon-jia text-primary"  @click="addCityFn()"></text>
                添加城市
              </view>
            </view>
          </u-form-item>
        </view>
        <view class="pt-3 font-md font-weight">企业资质</view>
        <view class="form">
          <u-form-item
            class="required"
            id="companyAptitudeListScroll"
            label="上传资质"
            label-position="top"
            :border-bottom="false"
          >
          <view class="d-flex bg-primary px-2   j-center  rounded-8 w-100 text-primary border-light upBox" @click="uploadPualificationFn">
            上传
          </view>
          </u-form-item>
          <view class="d-flex bg-grey p-2 mb-1 rounded-8 a-center position-relative" v-for="(item,index) in companyFormData.companyAptitudeList" :key="index">
            <view>
              <image class="u-skeleton-circle imagesBox" style="width: 140rpx; height: 140rpx; border-radius: 0;" :src="http.config.baseURL +item.fileVo.filePreviewUrl"></image>
            </view>
            <view class="p-2 flex-1">
              <view class="font-weight font-sm ">{{item.companyAptitudeName}}</view>
              <view  class="font-weight font-sm p">{{item.lv}}</view>
              <view class="font text-tips p">有效期截止日期：{{item.validEndDate}}</view>
            </view>
            
            <text class="pl-1 iconfont icon-shanchu text-error position-absolute top-2 right-2 "  @click="delAptitudeFn(index)"></text>
          </view>
        </view>
        <view class="pt-3 font-md font-weight">企业收益规则</view>
        <view class="form">
          <u-form-item  label="收益规则" label-position="top" :border-bottom="false">
            <u-input border height="80" type="number" v-model="companyFormData.companyDivideIntoRuleValue" placeholder="请输入收益规则" />
          </u-form-item>
          <u-form-item
            label="上传规则说明"
            label-position="top"
            :border-bottom="false"
          >
            <image-upload
              :dataType="1"
              name="file"
              :remove="true"
              :headers="header"
              :action="uploadFileUrl"
              v-model="companyDivideIntoRuleFile"
              :compress="true"
              :quality="60"
              mediaType="image"
              :add="true"
              @uploadSuccess="uploadCompanyDivideIntoRuleFn"
            ></image-upload>
          </u-form-item>
        </view>
      </u-form>					
    </view>
    
    <view class="px-3 searchBox" v-if="current == 3 && isShowName == 'join'">
      <u-form :model="formData" ref="uForm">
        <view class="d-flex  pt-5 form "  >
          <view>
            <hpy-form-select
              :dataList="industrialMarkList"
              text="name"
              name="dictId"
              v-model="formData.companyServiceTypeId"
              title="全部产业"
              @change="getcompanyServiceTypeName"
              hideBorder
            />
              
            </u-form-item>
          </view>
          <view class="ml-1 ">
            <u-search
              placeholder="搜索"
              placeholder-color="#fff"
              v-model="keyword"
              :show-action="false"
            ></u-search>
          </view>
        </view>
      </u-form>		
      <view class="mt-2">
          <ly-tree
            ref="tree"
            check-on-click-node
            :filter-node-method="filterNode"
            child-visible-for-filter-node
            :props="props"
            :tree-data="companyList"
            node-key="companyId"
            :children="'childNode'"
            :showRadio="showRadio"
            :checkOnlyLeaf="checkOnlyLeaf"
          ></ly-tree>
      </view>	
    </view>
    
    <view class="px-6" v-if="current == 4">
      <view class="mt-6 ">
        <view class="d-flex j-center" >
          <image
            mode="aspectFit"
            class=" imagesBox"
            style="width: 120rpx; height: 120rpx; margin: 0 auto;"
            :src="getStaticFilePath('cg.png')"
          ></image>
        </view>
        
        <view class="text-c font-lg text-main pt-4">完成注册</view>
        <view class="text-c font-sm text-tips pt-1">恭喜 您已成功完成注册</view>
      </view>		
    </view>
    
    </scroll-view>
      <view class="bottom-section">
       <button v-if='current==1' class="primaryBnt" :disabled="isDisabled"
        @click="hanglgReadFn">已阅读并同意协议<text v-if="remainingTime > 0">（{{ remainingTime }} s）</text></button>
      <button v-if='current==2' class="primaryBnt" @click="hanglgUserInfoFn"
        >下一步</button>
      <button v-if="current == 3 && isShowName == ''" class="primaryBnt" @click="hanglgJoinCompanyFn"
        >下一步</button>
      <button v-if="current == 3 && isShowName == 'signIn'" class="primaryBnt" @click="hanglgRegistrationFn">完成注册</button>
      <button v-if="current == 3 && isShowName == 'join'" class="primaryBnt" @click="joinNewVentureFn">下一步</button>
      <button v-if="current == 4"  class="primaryBnt" @click="hanglgLoginFn">登 录</button>
    </view>
    
    <verify @success="verifySuccessfullyFn" :mode="'pop'" :captchaType="'blockPuzzle'" :imgSize="{ width: '300px', height: '155px' }" ref="verify"></verify>
    <cascader ref="cascader" :cascaderData="cascaderData"  :selectValue="companyFormData.companyServiceAreaList"	 @confirem="cascaderConfirem"></cascader>
    <organization ref="organization" @confirom="queryCorpanyFn"></organization>
    <qualification ref="qualification" @confiromQualificationFn="queryQualificationFn"></qualification>
  </view>
</template>

<script>
import stepBar from '@/userPages/components/stepBar/stepBar.vue';
import verify from '@/userPages/components/verify/verify';
import { isValidPhoneNumber } from '@/utils/tool.js';
	import { encrypt } from '@/utils/encrypFile';
	import {uploadUrl, sendVerifyMobileSms,getDictByParentId ,registerGetCompanyList,userAndCompanyRegister,getCompanySelectByCompanyServiceTypeId} from '@/api/apis.js';
	import {cascaderData} from "@/utils/provincesData.js";
	import organization from '@/userPages/components/organization.vue';
	import qualification from '@/userPages/components/qualification.vue';
	import cascader from '@/userPages/components/cascader.vue';
	import uniDataCheckbox from '@/userPages/components/uni-data-checkbox/uni-data-checkbox.vue' ;	
	import { http } from '@/api/service.js';
	export default {
	components: {
		verify,
		cascader,
		organization,
		qualification,
		uniDataCheckbox,
		stepBar
	},
  data() {
    return {
		scrollTop: '',
	    old: {
			scrollTop: ''
		},
	  remainingTime: 5, // 初始倒计时时间
	  timer: null, // 计时器
	  isDisabled: true,
	  uploadFileUrl: uploadUrl,
	  header: {
	  	token: uni.getStorageSync('ims-token')
	  },
	  http,
	  title: '注册',
	  statusBarHeight: '',
	  navBarHeight: '',
	  numList: [
	  	{
	  		name: '用户注册协议',
	  		id:"1"
	  	},
	  	{
	  		name: '基本信息填写',
	  		id:"2"
	  	},
	  	{
	  		name: '加入企业',
	  		id:"3"
	  	},
	  	{
	  		name: '完成注册',
	  		id:"4"
	  	}
	  ],
	  current: 1,
	  tips: '',
	  seconds: 10,
	  show:false,
	  formData:{
	  	companyServiceTypeId:'',
	  },
	  props: {
	  	label: 'companyName', 
	  	children: 'childNode' 
	  },
	  showRadio:true,
	  checkOnlyLeaf: true, 
	  companyServiceTypeList:[],
	  companyServiceAreaListName:[],
	  industrialMarkList:[],
	  userFormData: {
	  	realName: '',
	  	mobile: '',
	  	pwd:'',
	  	confirmPwd:'',
	  	smsCode:'',
	  	isRegisterNewCompany:false,
	  	joinCompanyId: ""
	  },
	  companyCardFile:[],
	  companyDivideIntoRuleFile:[],
	  companyFormData:{	
	  	companyName:'',
	  	companyCardTypeId:'',
	  	companyCardTypeName:'',
	  	companyCardNumber:'',
	  	companyAddress:'',
	  	businessRange:'',
	  	companyCardFile:{},
	  	parentCompanyId:'',
	  	parentCompanyName:'',
	  	companyServiceTypeList:[],//展业标记
	  	companyServiceAreaList:[], //服务城市
	  	companyAptitudeList:[],
	  	companyDivideIntoRuleValue:'',
	  	companyDivideIntoRuleFile:{}
	  	
	  },
	  src: '',
	  selected: '',
	  isShowName: '',
	  certificateTypeList: [],
	  companyList:[],
	  list2: [
	  	{
	  		name: '生态修复',
	  		disabled: false
	  	},
	  	{
	  		name: '生态修复',
	  		disabled: false
	  	},
	  	{
	  		name: '生态修复',
	  		disabled: false
	  	}
	  ],
	  keyword:'',
	  value:'',
	  cascaderData
    };
  },
  watch: {
  	filterText(val) {
  		this.$refs.tree.filter(val, this.filterNodeData);
  	}
  },
  onShow() {
  	this.startCountdown();
  },
  onHide() {
  	this.clearCountdown();
  },
  onLoad() {
  	/*#ifdef MP*/
  	let that = this;
  	uni.getSystemInfo({
  		success: function(info) {
  			// 屏幕高度
  			let screenHeight = info.screenHeight;
  			// 屏幕宽度
  			let screenWidth = info.screenWidth;
  			// 胶囊高度
  			//状态栏高度
  			that.statusBarHeight = info.statusBarHeight * 2 + 'rpx';
  			let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  			let navBarHeight = menuButtonInfo.bottom + menuButtonInfo.top - screenHeight;
  			that.navBarHeight = navBarHeight + screenHeight - info.statusBarHeight + 'rpx';
  		}
  	});
  	/*#endif*/
	this.getDictFn();
	this.registerGetCompanyFn();
	this.industrialMarkFn();
  },
  options: {
  	styleIsolation: 'shared' // 解除样式隔离
  },
  methods:{
	  //计时器
	  startCountdown() {
	  	this.timer = setInterval(() => {
	  		if (this.remainingTime > 0) {
	  			this.remainingTime--;
	  		} else {
	  			this.clearCountdown();
	  		}
	  	}, 1000);
	  },
	  //清除计时器
	  clearCountdown() {
	  	clearInterval(this.timer);
	  	this.timer = null;
	  	this.isDisabled = false;
	  },
	  //阅读
	  hanglgReadFn() {
	  	this.current = this.current + 1;
	  	
	  },
	  //验证用户信息
	  validUserRuleFn(){
	  	if (this.userFormData.realName == '') {
	  		this.$u.toast('请输入您的姓名');
	  		return false;
	  	}
	  	if (this.userFormData.mobile == '') {
	  		this.$u.toast('请输入您的手机号码');
	  		return false;
	  	}
	  	if (this.userFormData.pwd == '') {
	  		this.$u.toast('请输入您的密码');
	  		return false;
	  	}
	  	if (this.userFormData.confirmPwd == '') {
	  		this.$u.toast('请输入确认您的密码');
	  		return false;
	  	}
	  	if (this.userFormData.smsCode == '') {
	  		this.$u.toast('请输入您的验证码');
	  		return false;
	  	}
	  	if (this.userFormData.pwd!= this.userFormData.confirmPwd) {
	  		this.$u.toast('请保证两次输入的密码一致');
	  		return false;
	  	}
	  	return true;
	  },
	  //显示图形验证码
	  showSliderVerifyFn() {
	  	if (this.queryCodeValidRuleFn()) {
	  		this.$refs.verify.show();
	  	}
	  },
	  //验证码校验
	  queryCodeValidRuleFn() {
	  	if (!isValidPhoneNumber(this.userFormData.mobile)) {
	  		this.$u.toast('请输入正确手机号码');
	  		return false;
	  	}
	  	return true;
	  },
	  //验证成功
	  verifySuccessfullyFn(e) {
	  	this.getCodeFn();
	  	this.$refs.verify.close();
	  },
	  //获取验证码
	  getCodeFn() {
	  	if (this.$refs.uCode.canGetCode) {
	  		sendVerifyMobileSms({
	  			mobile: this.userFormData.mobile
	  		}).then(res => {
	  			uni.showLoading({
	  				title: '正在获取验证码',
	  				mask: true
	  			});
	  			if (res.code == 10000) {
	  				setTimeout(() => {
	  					uni.hideLoading();
	  					this.$u.toast('验证码已发送');
	  					this.$refs.uCode.start();
	  				}, 2000);
	  			} else {
	  				this.$u.toast(res.msg);
	  			}
	  		});
	  	} else {
	  		this.$u.toast('验证码已发送，请稍后再试');
	  	}
	  },
	  //验证用户信息
	  hanglgUserInfoFn(){
	  	if(this.validUserRuleFn()){
	  		this.current = this.current + 1;
	  	}
	  },
	  //修改验证码提示文字
	  codeChange(text) {
	  	this.tips = text;
	  },	
	  	//选择是否注册新公司
	  selectStyle(style) {
	  	this.selected = style;
	  	if(this.selected=='signIn'){
	  		this.userFormData.isRegisterNewCompany=true;
	  	}else {
	  		this.userFormData.isRegisterNewCompany=false;
	  	}
	  },
	  // 获取证件类型
	  getDictFn(){
	  	getDictByParentId({
	  		parentId:'COMPANY_CARD_TYPE'
	  	}).then(res=>{
	  		if(res.code==10000){
	  			this.certificateTypeList=res.data;
	  		}else {
	  			this.$u.toast(res.msg);
	  		}
	  	})
	  },
	  //获取证件类型名称
	  queryVompanyCardTypeName(e){
	  	this.companyFormData.companyCardTypeName=e.data.name;
	  },
	  //获取公司
	  registerGetCompanyFn(){
	  	registerGetCompanyList().then(res=>{
	  		if(res.code==10000){
	  			this.companyList=res.data;
	  		}else {
	  			this.$u.toast(res.msg);
	  		}
	  	})
	  },
	  //获取产业标记
	  industrialMarkFn(){
	  	getDictByParentId({
	  		parentId:'COMPANY_SERVICE'
	  	}).then(res=>{
	  		if(res.code==10000){
	  			this.industrialMarkList=res.data.map(obj => ({ ...obj, ["checked"]: false ,['disabled']:false,['text']:obj.name,['value']:obj.dictId}));
	  			
	  		}else {
	  			this.$u.toast(res.msg);
	  		}
	  	})
	  },
	  //获取公司
	  getCompanySelectByCompanyServiceTypeFn(e){
	  	getCompanySelectByCompanyServiceTypeId({
	  		companyServiceTypeId:e?e.value:''
	  	}).then(res=>{
	  		if(res.code==10000){
	  			this.companyList=res.data.map(obj => ({...obj,["childNode"]: []}));
	  		}else {
	  			this.$u.toast(res.msg);
	  		}
	  	})
	  },
	  //切换产业标记
	  getcompanyServiceTypeName(e){
	  	this.getCompanySelectByCompanyServiceTypeFn(e);
	  	
	  },
	 //过滤
	 filterNode(value, data) {
	 	if (data.userVos) {
	 		data.userVos.forEach(a => {
	 			this.$set(a, 'companyName', a.realName);
	 			data.childNode.push(a);
	 		});
	 	}
	 	if (!value) return true;
	 	return data.companyName.indexOf(value) !== -1;
	 },
	  	//加入公司
	  	joinNewVentureFn(){
	  		let array = this.$refs.tree.getCheckedNodes(); 
	  		this.userFormData.joinCompanyId=array[0].companyId;
	  		userAndCompanyRegister({
	  			...this.userFormData,				
	  		}).then(res=>{		
	  			if (res.code == 10000) {		
	  				this.hanglgLoginFn();
	  			} else {
	  				this.$u.toast(res.msg);
	  			}
	  		})
	  		
	  	},
	  	//上传资质
	  	uploadPualificationFn(){
	  		 this.$refs.qualification.show()
	  	},
	  	//获取企业资质
	  	queryQualificationFn(e){
	  		this.companyFormData.companyAptitudeList.push(e);
	  	},
	  	//添加城市
	  	addCityFn(){
	  		 this.$refs.cascader.show()
	  	},	
	  	//确认城市
	  		cascaderConfirem(e){
				e.select_names.forEach(obj => {
				  if (obj['cityName'].includes('不限')) {
				    obj['cityName'] = obj['cityName'].replace(new RegExp('不限', 'g'), '');
				  }
				});			
	  			this.companyServiceAreaListName=e.select_names;
	  			this.companyFormData.companyServiceAreaList=e.select_ids;
	  		},
			
			
			
	  	//删除城市
	  	delCityFn(index){
	  		this.companyServiceAreaListName.splice(index,1);
	  		this.companyFormData.companyServiceAreaList.splice(index,1);
	  	},
	  	//获取标记
	  	queryCompanyServiceTypeFn(e){
	  		this.companyFormData.companyServiceTypeList=[];
	  		e.detail.data.forEach(x=>{
	  			this.companyFormData.companyServiceTypeList.push({
	  				serviceTypeId:x.dictId
	  			})
	  		})
	  	},
		
		//获取标记
		queryCompanyServiceTypeFn(e){
			this.companyFormData.companyServiceTypeList=[];
			e.detail.data.forEach(x=>{
				this.companyFormData.companyServiceTypeList.push({
					serviceTypeId:x.dictId
				})
			})
		},
	  	//删除资质
	  	delAptitudeFn(index){
	  		this.companyFormData.companyAptitudeList.splice(index,1);
	  	},
	  	//上传公司证件照
	  	uploadCompanyCardFileFn(res){
	  		var _res = JSON.parse(res.data);
	  		this.companyCardFile.push({
	  			fileId: _res.data.fileId,
	  			fileName: _res.data.fileName,
	  			fileSize: _res.data.fileSize,
	  			fileSuffix:_res.data.fileSuffix,
	  			filePreviewUrl: _res.data.filePreviewUrl,
	  			fileDownloadUrl:_res.data.fileDownloadUrl
	  		});
	  		this.companyFormData.companyCardFile = this.companyCardFile[0];
	  	},
	  
	  	
	  	//上传企业规则文件
	  	uploadCompanyDivideIntoRuleFn(res){
	  		var _res = JSON.parse(res.data);
	  		this.companyDivideIntoRuleFile.push({
	  			fileId: _res.data.fileId,
	  			fileName: _res.data.fileName,
	  			fileSize: _res.data.fileSize,
	  			fileSuffix:_res.data.fileSuffix,
	  			filePreviewUrl: _res.data.filePreviewUrl,
	  			fileDownloadUrl:_res.data.fileDownloadUrl
	  		});
	  	this.companyFormData.companyDivideIntoRuleFile = this.companyDivideIntoRuleFile[0];
	  	},	
	  	//获取上级组织
	  	queryOrganizationFn(){
	  		this.$refs.organization.show();
	  	},
	  	
	  	//获取上级组织
	  	queryCorpanyFn(e){
	  		this.companyFormData.parentCompanyId=e.companyId;
	  		this.companyFormData.parentCompanyName=e.companyName;
	  	},
	  	//加入公司
	  	hanglgJoinCompanyFn() {
	  		if (this.selected == '') {
	  			this.$u.toast('请选择类型');
	  		} else {
	  			if (this.selected == 'signIn') {
	  				this.isShowName = 'signIn';
	  			} else {
	  				this.isShowName = 'join';
	  			}
	  		}
	  	},	
	  
	  		//完成注册
	  		hanglgRegistrationFn(){
	  			if(this.queryCompanyValidRuleFn()){
					this.companyFormData.companyServiceAreaList.forEach(obj => {
					  if (obj['cityCode'].includes('_')) {
						  obj['cityCode']='';
					    // obj['cityCode'] = obj['cityCode'].replace(new RegExp('_', 'g'), '');
					  }
					});
	  				this.userFormData.pwd=encrypt(`${this.$u.trim(this.userFormData.pwd)}`);
	  				this.userFormData.confirmPwd =encrypt(`${this.$u.trim(this.userFormData.confirmPwd)}`);
	  				userAndCompanyRegister({
	  					...this.userFormData,
	  					userRegisterNewCompanySaveVo:{
	  						...this.companyFormData						
	  					}				
	  				}).then(res=>{		
	  					if (res.code == 10000) {		
	  						// this.hanglgLoginFn();
	  						this.current=this.current+1;
	  						this
	  					} else {
	  						this.$u.toast(res.msg);
	  					}
	  				})
	  			}	
	  		},
	  		//验证码校验
	  		queryCompanyValidRuleFn() {
	  			if (this.companyFormData.companyName == '') {
	  				this.$u.toast('请输入公司名称');
					this.goTop('companyNameScroll');
	  				return false;
	  			}
	  			if (this.companyFormData.companyCardTypeId == '') {
	  				this.$u.toast('请选择证件类型');
					this.goTop('companyCardTypeScroll');
	  				return false;
	  			}
	  			if (this.companyFormData.companyCardNumber == '') {
	  				this.$u.toast('请输入证件号码');
					this.goTop('companyCardNumberScroll');
	  				return false;
	  			}
	  			if (this.companyFormData.companyAddress == '') {
	  				this.$u.toast('请输入注册地址');
					this.goTop('companyAddressScroll');
	  				return false;
	  			}
	  			if (this.companyFormData.businessRange == '') {
	  				this.$u.toast('请输入业务范围');
					this.goTop('businessRangeScroll');
	  				return false;
	  			}
	  			if (!this.companyCardFile.length) {
	  				this.$u.toast('请上传证件照片');
					this.goTop('companyCardFileScroll');
	  				return false;
	  			}
	  			if (this.companyFormData.parentCompanyName == '') {
	  				this.$u.toast('请选择上级组织');
					this.goTop('parentCompanyNameScroll');
	  				return false;
	  			}
	  			if (!this.companyServiceTypeList.length) {
	  				this.$u.toast('请选择产业标记');
					this.goTop('companyServiceTypeListScroll');
	  				return false;
	  			}
	  			if(!this.companyServiceAreaListName.length){
	  				this.$u.toast('请选择服务地区');
					this.goTop('companyServiceAreaListNameScroll');
	  				return false;
	  			}
	  			if(!this.companyFormData.companyAptitudeList.length){
	  				this.$u.toast('请添加企业资质');
					this.goTop('companyAptitudeListScroll');
	  				return false;
	  			}
	  		
	  			return true;
	  		},
			
			goTop(e) {
				this.scrollTop = this.old.scrollTop;
				this.$nextTick(function() {
					this.scrollTop = e;
				});
			},
	  	  
	  	//登录
	  	hanglgLoginFn() {
	  		this.$Router.replaceAll({
	  			path: '/userPages/pages/login/login'
	  		});
	  	},
	  	backFn() {
	  		this.$Router.replaceAll({
	  			path: '/userPages/pages/login/login'
	  		});
	  	}
  }
};
</script>

<style scoped lang="scss">
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  
  .text-tips {
    view {
      color: #535a6c;
      font-size: 30rpx;
      line-height: 44rpx;
      &.plain {
        text-indent: 56rpx;
      }
      &.t1 {
        margin: 32rpx 0;
        font-weight: 600;
      }
      &.t2 {
        margin: 32rpx 0;
        font-weight: 600;
      }
      &.t1+.t2 {
        margin-top: -32rpx;
        margin-bottom: 32rpx;
      }
    }
  }
}

.top-section {
  height: 570rpx;
  text-align: center;
  background-image: url($custom-bg-img-url+'headBg.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
  position: relative;
  z-index: 1;
  /* #ifdef  H5 */
  .nav {
  	padding-top: 50rpx;
  }
  /* #endif */
  .steps {
	  margin-top:50rpx;
  }
}

.middle-section {
  flex: 1;
  overflow-y: auto; 
  background-color: #fff;
  margin-top: -25%; 
  border-top-left-radius: 25px; 
  border-top-right-radius:25px; 
  position: relative;
  z-index: 2;
  // padding-bottom: 50px; 
  .form {
  	position: relative;
  	.code {
  		position: absolute;
  		bottom: 30rpx;
  		right: 50rpx;
  		::v-deep .u-size-medium {
  			padding: 0 20rpx;
  			height: 64rpx !important;
  			line-height: 64rpx !important;
  		}
  	}
  }
  
  .corpBox {
  	border-radius: 8px;
  	border: 1px solid #0052d9;
  }
  
  .active {
  	background-color: #F4F9FF;
  	
  }
  .activeText {
  	color: #0052d9;
  }
  ::v-deep .u-checkbox__icon-wrap {
  	border: 1px solid #dcdfe6 !important;
  	background-color: #dcdfe6 !important;
  }
  
  .upBox {
  	height: 160rpx;
  	line-height: 160rpx;
  }
  
  
  .searchBox {
  	::v-deep .select-picker {
  		width: 120px !important;
  	}
  	::v-deep .u-content {
  		border-radius: 8px !important;
  		    height: 42px !important;
  			background-color: #f2f3f5 !important;
  	}
  	
  }
  ::v-deep .select-picker {
  		width: 688rpx !important;
  	}
  
  	
  ::v-deep  .checklist-box {
  	width: 26% !important;
   }
	::v-deep .uicon-search {
  		color: #0052d9 !important;
  	}
}


.bottom-section {
  // flex: 0 0 50px;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* 如果中间区域内容过多，可能会溢出到底部区域上方，
     这时可以通过设置底部区域的z-index来确保它显示在最上层。 */
  z-index: 3;
  padding-top: 30rpx;
  padding-bottom: env(safe-area-inset-bottom);
}
</style>

